﻿using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;

namespace YArchitech.HVAC.AuxiliaryCurve
{
	public class RectSelction : AuxiliarySelection
	{
		public RectSelction(ExternalCommandData cmd)
		{
			this.m_cmd = cmd;
			this.sel = this.m_cmd.Application.ActiveUIDocument.Selection;
		}

		public override bool Select()
		{
			PickedBox pickedBox = this.sel.PickBox((Autodesk.Revit.UI.Selection.PickBoxStyle)0, "选择绘制区域……");
			base.Min = pickedBox.Min;
			base.Max = pickedBox.Max;
			while (base.Min.DistanceTo(base.Max) <= this.m_cmd.Application.Application.ShortCurveTolerance)
			{
				pickedBox = this.sel.PickBox((Autodesk.Revit.UI.Selection.PickBoxStyle)0, "选择绘制区域……");
				base.Min = pickedBox.Min;
				base.Max = pickedBox.Max;
			}
			return true;
		}
	}
}
